package com.magnificent.atlantis.client.ui.planner.panels.task.attribute;

import com.magnificent.atlantis.client.ui.planner.PlannerData;
import com.magnificent.atlantis.client.ui.planner.panels.task.treetable.PlannerTreeTable;
import com.magnificent.atlantis.client.ui.planner.panels.task.treetable.data.PlannerTableNode;

import javax.swing.*;
import java.awt.*;

/**
 * User: Babanin
 * Date: 05.05.2009
 * Time: 18:37:23
 */
public abstract class AbstractTaskAttributePanel extends JPanel {
    protected PlannerData plannerData;
    protected TaskPanelInjector panelInjector;

    public AbstractTaskAttributePanel(PlannerData plannerData, TaskPanelInjector panelInjector) {
        this.plannerData = plannerData;
        this.panelInjector = panelInjector;

        setLayout(new BorderLayout());
    }

    public PlannerTableNode getSelectedNode() {
        if (panelInjector != null) {
            return panelInjector.getSelectedNode();
        }

        return null;
    }

    public PlannerTreeTable getTreeTable() {
        if (panelInjector != null) {
            return panelInjector.getTreeTable();
        }

        return null;
    }

    public void rebuildModel() {
        panelInjector.rebuildModel();
    }

    public abstract void taskSelected();
}
